
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;

namespace Swaf.Container
{
	/// <summary>
	/// Summary description for ReadOnlyDictionary.
	/// </summary>
	public class ReadOnlyDictionary : IDictionary, IEnumerable
	{
		protected IDictionary m_d;
		public ReadOnlyDictionary(IDictionary d)
		{
			m_d = d;
		}
		#region IEnumerable Members

		public IEnumerator GetEnumerator()
		{
			return m_d.GetEnumerator();
		}

		#endregion
	
		#region IDictionary Members

		public bool IsReadOnly {get{return true;}}

		IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator()
		{
			return m_d.GetEnumerator();
		}

		public object this[object key]
		{
			get
			{
				return m_d[key];
			}
			set
			{
				throw new NotSupportedException();
			}
		}

		public void Remove(object key)
		{
			throw new NotSupportedException();
		}

		public bool Contains(object key)
		{
			return m_d.Contains(key);
		}

		public void Clear()
		{
			throw new NotSupportedException();
		}

		public ICollection Values {	get{return m_d.Values;}}

		public void Add(object key, object value)
		{
			throw new NotSupportedException();
		}

		public ICollection Keys {get{return m_d.Keys;}}

		public bool IsFixedSize {get{return m_d.IsFixedSize;}}

		#endregion

		#region ICollection Members

		public bool IsSynchronized {get{return m_d.IsSynchronized;}}

		public int Count {get{return m_d.Count;}}

		public void CopyTo(Array array, int index)
		{
			m_d.CopyTo(array, index);
		}

		public object SyncRoot
		{
			get
			{
				return m_d.SyncRoot;
			}
		}

		#endregion
	}
}
